# 1.点击分类名称为“商品分类测试”后方的删除分类"链接
import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*
import re
from selenium.webdriver.support.select import Select
testCase="DBshop013_商品管理管理商品商品分类编辑商品分类"
#调用浏览器打开后台网址
firefox=openBrowser(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
#后台3级菜单登录管理商品页面
DBshopEnterMenu3(firefox, "商品管理","管理分类","商品分类")
#点击“商品分类测试”后方的编辑链接
firefox.find_element_by_xpath('//td[contains(.,"%s")]/following-sibling::td[4]/a[3]'% (goodsClassName)).click()
#点击js弹窗的确认按钮
firefox.switch_to_alert().accept()
#检查商品后台是否还有该分类
#断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%goodsClassName).is_displayed()
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)
firefox.quit()
